package com.lengxf.job.dynamicTask;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Configuration
public class ThreadPoolTaskExecutorConfig {

    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler syncScheduler = new ThreadPoolTaskScheduler();
        syncScheduler.setPoolSize(5);
        syncScheduler.setThreadGroupName("taskTg");
        syncScheduler.setThreadNamePrefix("taskThread-");
        syncScheduler.initialize();
        return syncScheduler;
    }

}

